const scoresService = require('../service/scoresService')
class ScoresController {
  async getScoresList(ctx, next) {
    const { pagenum, pagesize, sportName, athleteName,collegeId,sportId,athleteId } = ctx.request.body 
    const res = await scoresService.getScoresList(pagenum, pagesize, sportName, athleteName,collegeId,sportId,athleteId)
    ctx.body = {
      data: {
        pagenum,
        ...res
      },
      meta: {
        msg: '获取成功',
        status:200
      }
    }

  }
  async updateScore(ctx, next) {
    const { id } = ctx.params 
    const { score, rank } = ctx.request.body 
    await scoresService.updateScore(score,rank,id)
    ctx.body = {
      msg:'success'
    }
  }
}

module.exports = new ScoresController()